<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        html,body{
            width: 100%;
            height: 100%;
        }
        #app{
            position: absolute;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            margin: auto;

            width: 200px;
            height: 200px;
            background: pink;

            transition: 5s width;
        }
    </style>
</head>
<body>
    <!--
        transition在元素首次渲染还没有结束的情况下 是不会被触发的
    -->
    <!--<div id="app">

    </div>-->
</body>
<script>
    window.onload=function () {
        // var appNode = document.querySelector("#app");
        var appNode = document.createElement("div");
        appNode.id = "app";
        setTimeout(()=>{
            appNode.style.width = "400px";
        },0)
        document.body.appendChild(appNode)
    }
</script>
</html>